package com.itheima;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/MyServlet")
public class MyServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //1.获取请求
        String name = request.getParameter("name");
        String sex = request.getParameter("sex");
        //2.业务处理
        System.out.println("name="+name +"\nsex="+sex);
        //3.响应
        response.getWriter().print("Hello");



        System.out.println("MyServlet被访问 ");
    }
}
